const BASE_URL = "http://127.1.1.0:3009"

export function request(config={}){
		
		let {url,method="GET" ,data} = config
		
		url = BASE_URL+url
	
	return new Promise((resolve,reject)=>{
		uni.request({
			url,
			method,
			data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
			},
			success:res=>{
				if(res.data.code==200){
					resolve(res)
				}else{
					uni.showModal({
						title:"错误提示",
						content:res.data.mess,
						showCancel:false
					})
				}
				// console.log(res.data,"这是返回的结果")
				
			}, 
			fail:err=>{
				reject(err)
			}
		})
	})
}